﻿using Basic.FormGatewaryModular.Interface;
using Basic.FormRemoteModel.PageLayout;
using Basic.FormRemoteModel.PageLayout.Model;

namespace Basic.FormGatewaryModular.Services
{
    internal class PageLayoutService : IPageLayoutService
    {
        public PageLayoutBase Add ( PageLayoutAdd add )
        {
            return new AddPageLayout
            {
                Datum = add
            }.Send();
        }
        public void Move ( long id, long parentId )
        {
            new MovePageLayout
            {
                Id = id,
                ParentId = parentId
            }.Send();
        }
        public void Delete ( long id )
        {
            new DeletePageLayout
            {
                Id = id
            }.Send();
        }

        public PageLayoutData Get ( long id )
        {
            return new GetPageLayoutInfo
            {
                Id = id
            }.Send();
        }

        public void SaveSort ( Dictionary<long, int> sort )
        {
            new SetPageLayoutSort
            {
                Sort = sort
            }.Send();
        }

        public bool Set ( long id, PageLayoutSet set )
        {
            return new SetPageLayout
            {
                Id = id,
                Datum = set
            }.Send();
        }

        public PageLayoutForm[] GetForm ( long pageId )
        {
            return new GetPageLayoutForm
            {
                PageId = pageId
            }.Send();
        }
    }
}
